home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / scsh-0.4 / scsh-0 / scsh-0.4.2 / scsh / sunos / tty-consts.scm < prev    next >
Text File  |  1995-10-31  |  8KB  |  218 lines

  1. ;;; Constant definitions for tty control code (POSIX termios).
  2. ;;; Copyright (c) 1995 by Brian Carlstrom.
  3. ;;; Largely rehacked by Olin.
  4.  
  5. ;;; These constants are for SunOS 4.x.x, 
  6. ;;; and are taken from /usr/include/sys/termio.h
  7. ;;;            and /usr/include/sys/termios.h
  8. ;;;            and /usr/include/sys/ttydev.h
  9.  
  10. ;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
  11. ;;; - Some of the baud rates.
  12.  
  13.  
  14. ;;; Special Control Characters 
  15. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  16. ;;;  Indices into the c_cc[] character array.
  17.  
  18. ;;;    Name                 Subscript    Enabled by 
  19. ;;;     ----                 ---------    ----------
  20. ;;;  POSIX
  21. (define ttychar/eof        4)        ; ^d icanon
  22. (define ttychar/eol        5)        ;    icanon
  23. (define ttychar/delete-char    2)        ; ^? icanon
  24. (define ttychar/delete-line    3)        ; ^u icanon
  25. (define ttychar/interrupt    0)        ; ^c isig
  26. (define ttychar/quit        1)        ; ^\ isig
  27. (define ttychar/suspend        10)        ; ^z isig
  28. (define ttychar/start        8)        ; ^q ixon, ixoff
  29. (define ttychar/stop        9)        ; ^s ixon, ixoff
  30. (define ttychar/min        4)        ;    !icanon    ; Not exported
  31. (define ttychar/time        5)        ;    !icanon    ; Not exported
  32.  
  33. ;;; SVR4 & 4.3+BSD
  34. (define ttychar/delete-word    14)        ; ^w icanon
  35. (define ttychar/reprint     12)        ; ^r icanon
  36. (define ttychar/literal-next    15)        ; ^v iexten
  37. (define ttychar/discard        13)        ; ^o iexten
  38. (define ttychar/delayed-suspend    11)        ; ^y isig
  39. (define ttychar/eol2        6)        ;    icanon
  40.  
  41. ;;; 4.3+BSD
  42. (define ttychar/status        16)        ; ^t icanon 
  43.  
  44. ;;; Length of control-char string -- *Not Exported*
  45. (define    num-ttychars        17)
  46.  
  47. ;;; Magic "disable feature" tty character
  48. (define disable-tty-char (ascii->char #x00))    ; _POSIX_VDISABLE
  49.  
  50. ;;; Flags controllling input processing
  51. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  52.  
  53. ;;;  POSIX
  54. (define ttyin/ignore-break        #x00001)    ; ignbrk
  55. (define ttyin/interrupt-on-break    #x00002)    ; brkint
  56. (define ttyin/ignore-bad-parity-chars    #x00004)    ; ignpar
  57. (define ttyin/mark-parity-errors    #x00008)    ; parmrk
  58. (define ttyin/check-parity        #x00010)    ; inpck
  59. (define ttyin/7bits            #x00020)    ; istrip
  60. (define ttyin/nl->cr            #x00040)    ; inlcr
  61. (define ttyin/ignore-cr            #x00080)    ; igncr
  62. (define ttyin/cr->nl            #x00100)    ; icrnl
  63. (define ttyin/output-flow-ctl        #x00400)    ; ixon
  64. (define ttyin/input-flow-ctl        #x01000)    ; ixoff
  65.  
  66.  
  67. ;;; SVR4 & 4.3+BSD
  68. (define ttyin/xon-any           #x800)    ; ixany: Any char restarts after stop
  69. (define ttyin/beep-on-overflow #x2000)    ; imaxbel: queue full => ring bell
  70.  
  71. ;;; SVR4
  72. (define ttyin/lowercase           #x200)    ; iuclc: Map upper-case to lower case
  73.  
  74.  
  75. ;;; Flags controlling output processing
  76. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  77.  
  78. ;;;  POSIX 
  79. (define    ttyout/enable         #o000001)  ; opost: enable output processing
  80.  
  81. ;;; SVR4 & 4.3+BSD
  82. (define ttyout/nl->crnl         #o000004)    ; onlcr: map nl to cr-nl
  83.  
  84. ;;; 4.3+BSD
  85. (define ttyout/discard-eot     #f)        ; onoeot
  86. (define ttyout/expand-tabs     #f)        ; oxtabs (NOT xtabs)
  87.  
  88. ;;; SVR4
  89. (define ttyout/cr->nl         #x000008)    ; ocrnl
  90. (define ttyout/fill-w/del     #x000080)    ; ofdel
  91. (define ttyout/delay-w/fill-char #x000040)    ; ofill
  92. (define ttyout/uppercase     #x000002)    ; olcuc
  93. (define ttyout/nl-does-cr     #x000020)    ; onlret
  94. (define ttyout/no-col0-cr     #x000010)    ; onocr
  95.  
  96. ;;; Newline delay
  97. (define    ttyout/nl-delay        #x000100)    ; mask (nldly)
  98. (define     ttyout/nl-delay0    #x000000)
  99. (define     ttyout/nl-delay1    #x000100)    ; tty 37 
  100.  
  101. ;;; Horizontal-tab delay
  102. (define    ttyout/tab-delay    #x001800)    ; mask (tabdly)
  103. (define     ttyout/tab-delay0    #x000000)
  104. (define     ttyout/tab-delay1    #x000800)    ; tty 37 
  105. (define     ttyout/tab-delay2    #x001000)
  106. (define     ttyout/tab-delayx    #x001800)    ; Expand tabs (xtabs, tab3)
  107.  
  108. ;;; Carriage-return delay
  109. (define    ttyout/cr-delay        #x000600)    ; mask (crdly)
  110. (define     ttyout/cr-delay0    #x000000)
  111. (define     ttyout/cr-delay1    #x000200)    ; tn 300 
  112. (define     ttyout/cr-delay2    #x000400)    ; tty 37 
  113. (define     ttyout/cr-delay3    #x000600)    ; concept 100 
  114.  
  115. ;;; Vertical tab delay 
  116. (define    ttyout/vtab-delay    #x004000)    ; mask (vtdly)
  117. (define     ttyout/vtab-delay0    #x000000)
  118. (define     ttyout/vtab-delay1    #x004000)    ; tty 37 
  119.  
  120. ;;; Backspace delay
  121. (define    ttyout/bs-delay        #x002000)    ; mask (bsdly)
  122. (define     ttyout/bs-delay0    #x000000)
  123. (define     ttyout/bs-delay1    #x002000)
  124.  
  125. ;;; Form-feed delay
  126. (define ttyout/ff-delay        #x008000)    ; mask (ffdly)
  127. (define     ttyout/ff-delay0    #x000000)
  128. (define     ttyout/ff-delay1    #x008000)
  129.  
  130. (define    ttyout/all-delay
  131.   (bitwise-ior (bitwise-ior (bitwise-ior ttyout/nl-delay ttyout/tab-delay)
  132.                 (bitwise-ior ttyout/cr-delay ttyout/vtab-delay))
  133.            (bitwise-ior ttyout/bs-delay ttyout/ff-delay)))
  134.  
  135.  
  136. ;;; Control flags - hacking the serial-line.
  137. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  138.  
  139. ;;;  POSIX
  140. (define ttyc/char-size        #x00030)    ; csize: character size mask 
  141. (define  ttyc/char-size5    #x00000)    ; 5 bits (cs5)
  142. (define  ttyc/char-size6    #x00010)    ; 6 bits (cs6)
  143. (define  ttyc/char-size7    #x00020)    ; 7 bits (cs7)
  144. (define  ttyc/char-size8    #x00030)    ; 8 bits (cs8)
  145. (define ttyc/2-stop-bits    #x00040)    ; cstopb: Send 2 stop bits.
  146. (define ttyc/enable-read    #x00080)    ; cread: Enable receiver.
  147. (define ttyc/enable-parity    #x00100)    ; parenb
  148. (define ttyc/odd-parity        #x00200)    ; parodd
  149. (define ttyc/hup-on-close    #x00400)    ; hupcl: Hang up on last close.
  150. (define ttyc/no-modem-sync    #x00800)    ; clocal: Ignore modem lines.
  151.  
  152. ;;;  4.3+BSD
  153. (define    ttyc/ignore-flags     #f)    ; cignore: ignore control flags 
  154. (define ttyc/CTS-output-flow-ctl #f)    ; ccts_oflow: CTS flow control of output
  155. (define ttyc/RTS-input-flow-ctl  #f)    ; crts_iflow: RTS flow control of input
  156. (define ttyc/carrier-flow-ctl     #f)    ; mdmbuf
  157.  
  158. ;;; Local flags -- hacking the tty driver / user interface.
  159. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  160.  
  161. ;;;  POSIX
  162. (define ttyl/visual-delete    #x010)    ; echoe: Visually erase chars
  163. (define ttyl/echo-delete-line #x020)    ; echok: Echo nl after line kill
  164. (define ttyl/echo          #x008)    ; echo:  Enable echoing
  165. (define ttyl/echo-nl          #x040)    ; echonl: Echo nl even if echo is off
  166. (define ttyl/canonical          #x002)    ; icanon: Canonicalize input
  167. (define ttyl/enable-signals   #x001)    ; isig: Enable ^c, ^z signalling
  168. (define ttyl/extended         #x8000)    ; iexten:  Enable extensions
  169. (define ttyl/ttou-signal      #x100)    ; tostop: SIGTTOU on background output
  170. (define ttyl/no-flush-on-interrupt #x80) ; noflsh
  171.  
  172. ;;; SVR4 & 4.3+BSD
  173. (define ttyl/visual-delete-line #x0800); echoke: visually erase a line-kill 
  174. (define ttyl/hardcopy-delete    #x0400); echoprt: visual erase for hardcopy 
  175. (define ttyl/echo-ctl        #x0200); echoctl: echo control chars as "^X" 
  176. (define ttyl/flush-output    #x2000); flusho: output is being flushed
  177. (define ttyl/reprint-unread-chars #x4000); pendin: retype pending input
  178.  
  179. ;;; 4.3+BSD
  180. (define ttyl/alt-delete-word    #f)    ; altwerase
  181. (define ttyl/no-kernel-status    #f)    ; nokerninfo: no kernel status on ^T
  182.  
  183. ;;; SVR4
  184. (define ttyl/case-map #x4)    ; xcase: canonical upper/lower presentation
  185.  
  186. ;;; Vector of (speed . code) pairs.
  187.  
  188. (define baud-rates '#((0  . 0)        (1  . 50)    (2  .    75)
  189.               (3  . 110)    (4  . 134)    (5  .   150)
  190.               (6  . 200)    (7  . 300)    (8  .   600)
  191.               (9  . 1200)    (10 . 1800)     (11 .  2400)    
  192.               (12 . 4800)       (13 . 9600)    (14 .  19200)
  193.               (15 . 38400)    (14 . exta)     (15 .  extb)))
  194.  
  195. ;;; tcflush() constants
  196. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  197.  
  198. (define %flush-tty/input  0)    ; TCIFLUSH
  199. (define %flush-tty/output 1)    ; TCOFLUSH
  200. (define %flush-tty/both      2)    ; TCIOFLUSH
  201.  
  202.  
  203. ;;; tcflow() constants
  204. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  205.  
  206. (define %tcflow/start-out 1)    ; TCOON
  207. (define %tcflow/stop-out  0)    ; TCOOFF
  208. (define %tcflow/start-in  3)    ; TCION
  209. (define %tcflow/stop-in   2)    ; TCIOFF
  210.  
  211.  
  212. ;;; tcsetattr() constants
  213. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  214.  
  215. (define %set-tty-info/now    0)    ; TCSANOW   Make change immediately.
  216. (define %set-tty-info/drain    1)    ; TCSADRAIN Drain output, then change.
  217. (define %set-tty-info/flush    2)    ; TCSAFLUSH Drain output, flush input.
  218.